import request from "@/api/request/axios";
import Axios from "axios";
import { customerNoDesensitization } from "@/api/hubeixiaojin/HbUtils";

/**
 * ivr身份证验证
 */
export const queryLoanDetailsByIdNo = idNo => {
  return new Promise((resolve, reject) => {
    var phone = "";
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息

    head.serviceId = "CMIS100098";
    request.head = head;

    body.idNo = idNo; //身份证号
    request.body = body;

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = "dengw";
    reqData.agentId = "1001";
    reqData.source = "workbench";
    reqData.targetRoute = "custQueryLoanDetailsByIdentityCard";
    console.log(reqData);
    Axios.post(window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query", reqData)
      .then(res => {
        console.log(res);
        if (res.data.retCode == "200") {
          resData.retCode = "200";
          var queryData = res.data.data.applLoanListDetails;
          //var queryData = []
          // queryData.forEach(item => {
          //   for (let key in item) {
          //     if (key == "idNo") {
          //       item[key+"2"] = item[key]
          //       item[key] = customerNoDesensitization(item[key]);

          //     }
          //   }
          // });

          resData.data = queryData;
        } else {
          console.log("查询失败，idp接口调取失败");
          resData.msg = "查询失败";
        }
        resolve(resData);
      })
      .catch(err => {
        console.log("调用idp接口发生异常:" + err);
        resData.msg = "idp接口调用异常: " + err;
        reject(resData);
      });
  });
};

/**
 * 贷款申请详细信息（申请流水，单条）（CMIS100001）
 *
 */
export const queryInfo0CMIS100001 = applSeq => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    //拼接参数（CMIS100001，贷款申请详细信息）：
    var reqData_CMIS100001 = {};
    var targetbody_CMIS100001 = {};
    var request_CMIS100001 = {};
    var head_CMIS100001 = {}; //head信息
    var body_CMIS100001 = {}; //body信息
    head_CMIS100001.serviceId = "CMIS100001";
    request_CMIS100001.head = head_CMIS100001;

    body_CMIS100001.applSeq = applSeq; //客户申请编号
    request_CMIS100001.body = body_CMIS100001;

    targetbody_CMIS100001.request = request_CMIS100001;
    reqData_CMIS100001.targetbody = targetbody_CMIS100001;
    reqData_CMIS100001.targetSysCode = "esb";
    reqData_CMIS100001.actionCode = "query";
    reqData_CMIS100001.targetRoute = "directEsbQuery";
    console.log(reqData_CMIS100001);

    //调用CMIS100001接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS100001
    )
      .then(res => {
        console.log(res);
        if (res.data.retCode == "200") {
          resData.retCode = "200";
          //遍历循环，对身份证号和手机号码进行数据脱敏
          var queryData = res.data.data;
          var list = [];
          list.push(queryData);
          list.forEach(item => {
            for (let key in item) {
              if (key == "idNo" || key == "relMobile") {
                item[key] = customerNoDesensitization(item[key]);
              }
            }
          });
          console.log("测试:");
          console.log(list);
          //赋值
          resData.data = list[0];
          resolve(resData);
        } else {
          console.log(
            "申请流水号：" + applSeq + "调用CMIS100001发生异常:" + res
          );
          resData.msg =
            "申请流水号：" + applSeq + "调用CMIS100001发生异常:" + res;
          resData.retCode = "0";
          reject(resData);
        }
      })
      .catch(err => {
        console.log("申请流水号：" + applSeq + "调用CMIS100001发生异常:" + err);
        resData.msg = "个人贷款申请列表查询CMIS100001接口调用异常: " + err;
        resData.retCode = "0";
        reject(resData);
      });
  });
};

/**
 * 通过身份证号获取申请流水号列表（CMIS100098）
 *
 */
export const queryInfoCMIS100098 = param => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据

    var msg = "";
    var applSeqList = []; //客户申请编号列表
    //拼接参数（CMIS100098，用于查询客户的申请列表信息）：
    var reqData_CMIS100098 = {};
    var targetbody_CMIS100098 = {};
    var request_CMIS100098 = {};
    var head_CMIS100098 = {}; //head信息
    var body_CMIS100098 = param; //body信息
    head_CMIS100098.serviceId = "CMIS100098";
    request_CMIS100098.head = head_CMIS100098;

    // body_CMIS100098.idNo = param.idNo;
    // body_CMIS100098.idNo = param.idNo;
    // body_CMIS100098.idNo = param.idNo;
    // body_CMIS100098.idNo = param.idNo;

    request_CMIS100098.body = body_CMIS100098;

    targetbody_CMIS100098.request = request_CMIS100098;
    reqData_CMIS100098.targetbody = targetbody_CMIS100098;
    reqData_CMIS100098.targetSysCode = "esb";
    reqData_CMIS100098.actionCode = "query";
    reqData_CMIS100098.targetRoute = "directEsbQuery";
    // console.log("调用CMIS100098 请求参数：");
    // console.log(reqData_CMIS100098);

    // resData.data = [{'name':'1111'},{'name':'22222'}]
    // resData.retCode = 200
    // resolve(resData);

    //调用 CMIS100098 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS100098
    )
      .then(res => {
        // console.log("通过身份证号查询申请流水号列表：");
        // console.log(res);
        if (res.data.retCode == "200") {
          resData.retCode = "200";
          //业务处理逻辑：
          resData.data = res.data.data.applLoanList;
          resolve(resData);
        } else {
          resData.retCode = "0";
          resData.msg = "调用CMIS100098异常";
          reject(resData);
        }
      })
      .catch(err => {
        console.log(err);
        resData.msg = "个人贷款申请列表查询CMIS100098接口调用异常: " + err;
        resData.retCode = "0";
        reject(resData);
      });
  });
};

/**
 * 贷款申请详细信息（申请流水，多条）（CMIS100001）
 *
 */
export const queryInfoCMIS100001 = async applSeqList => {
  var resData = {};
  var resListData = [];
  var msg = "";
  try {
    //遍历客户申请编号列表，调用CMIS100001接口查询贷款申请详细信息
    if (applSeqList.length > 0) {
      for (const item of applSeqList) {
        var applSeq = item.applSeq;
        //拼接参数（CMIS100001，贷款申请详细信息）：
        var reqData_CMIS100001 = {};
        var targetbody_CMIS100001 = {};
        var request_CMIS100001 = {};
        var head_CMIS100001 = {}; //head信息
        var body_CMIS100001 = {}; //body信息
        head_CMIS100001.serviceId = "CMIS100001";
        request_CMIS100001.head = head_CMIS100001;

        body_CMIS100001.applSeq = applSeq; //客户申请编号
        request_CMIS100001.body = body_CMIS100001;

        targetbody_CMIS100001.request = request_CMIS100001;
        reqData_CMIS100001.targetbody = targetbody_CMIS100001;
        reqData_CMIS100001.targetSysCode = "esb";
        reqData_CMIS100001.actionCode = "query";
        reqData_CMIS100001.targetRoute = "directEsbQuery";
        // console.log("请求参数：" + reqData_CMIS100001);

        //调用 CMIS100001 核心接口
        const res2 = await Axios.post(
          window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
          reqData_CMIS100001
        );
        //Axios.post(window.CONFIG.idpServerUrl + '/biz/camel/v1/com/query',reqData_CMIS100001).then((res2) => {
        //console.log(res2)
        if (res2.data.retCode == "200") {
          //赋值
          var queryData = res2.data.data;
          //数据脱敏
          for (let key in queryData) {
            if (key == "idNo" || key == "relMobile") {
              queryData[key] = customerNoDesensitization(queryData[key]);
            }
          }
          resListData.push(queryData);
        } else {
          msg +=
            "申请流水号：" +
            applSeq +
            "调用CMIS100001发生异常:" +
            res2.msg +
            ";  ";
        }
      }
      resData.retCode = "200";
      resData.data = resListData;
      resData.msg = msg;
    } else {
      console.log("客户申请流水列表为空，请联系管理员");
      resData.retCode = "0";
      resData.msg = "客户申请流水列表为空，请联系管理员";
      resData.data = [];
    }
  } catch (error) {
    console.log("调用CMIS100001发生异常,请联系管理员");
    console.log(error);
    resData.retCode = "0";
    resData.msg = "调用CMIS100001发生异常,请联系管理员";
    resData.data = [];
  }
  return resData;
};

/**
 * 还款计划列表（放款后）查询（CMIS100003）
 *
 */
export const queryInfoCMIS100003 = params => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据

    //拼接参数（CMIS100003，用于查询还款计划列表）：
    var reqData_CMIS100003 = {};
    var targetbody_CMIS100003 = {};
    var request_CMIS100003 = {};
    var head_CMIS100003 = {}; //head信息
    var body_CMIS100003 = {}; //body信息
    head_CMIS100003.serviceId = "CMIS100003";
    request_CMIS100003.head = head_CMIS100003;

    body_CMIS100003.genGlNo = ""; //授权号
    body_CMIS100003.loanNo = params.loanNo; //借据号
    body_CMIS100003.userId = params.userId; //操作用户
    body_CMIS100003.userName = params.userName; //用户名称
    body_CMIS100003.userOrgNo = params.userOrgNo; //用户机构
    body_CMIS100003.enqTyp = "ALL"; //查询类型（页面上没看到需要选择的地方，先默认吧）

    request_CMIS100003.body = body_CMIS100003;

    targetbody_CMIS100003.request = request_CMIS100003;
    reqData_CMIS100003.targetbody = targetbody_CMIS100003;
    reqData_CMIS100003.targetSysCode = "esb";
    reqData_CMIS100003.actionCode = "query";
    reqData_CMIS100003.targetRoute = "directEsbQuery";
    console.log("调用CMIS100003 请求参数：");
    console.log(reqData_CMIS100003);
    // resolve(resData);
    //调用 CMIS100003 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS100003
    )
      .then(res => {
        console.log("查询还款计划列表结果：");
        console.log(res);
        //业务处理逻辑：
        if (res.data.retCode == "200") {
          resData.retCode = "200";

          resData.data = res.data.data.lmPmShdList;
          resolve(resData);
        } else {
          resData.retCode = "0";
          resData.msg = "个人贷款申请列表查询CMIS100003接口调用失败: " + res;
          reject(resData);
        }
      })
      .catch(err => {
        console.log(err);
        resData.msg = "个人贷款申请列表查询CMIS100003接口调用异常: " + err;
        resData.retCode = "0";
        reject(resData);
      });
  });
};

/**
 * 结清证明申请查询（CMIS10000X）
 * 核心还没提供
 *
 */
export const queryInfoCMIS10000X = applSeq => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    //拼接参数（CMIS100098，用于查询客户的申请列表信息）：
    var reqData_CMIS10000X = {};
    var targetbody_CMIS10000X = {};
    var request_CMIS10000X = {};
    var head_CMIS10000X = {}; //head信息
    var body_CMIS10000X = {}; //body信息
    head_CMIS10000X.serviceId = "CMIS100098";
    request_CMIS10000X.head = head_CMIS10000X;

    body_CMIS10000X.idNo = "";
    //body参数待添加
    //.....
    request_CMIS100098.body = body_CMIS10000X;

    targetbody_CMIS10000X.request = request_CMIS10000X;
    reqData_CMIS10000X.targetbody = targetbody_CMIS10000X;
    reqData_CMIS10000X.targetSysCode = "esb";
    reqData_CMIS10000X.actionCode = "query";
    reqData_CMIS10000X.targetRoute = "directEsbQuery";
    console.log("调用CMIS10000X 请求参数：");
    console.log(reqData_CMIS10000X);
    //调用 CMIS10000X 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS100003
    )
      .then(res => {
        console.log("查询结清证明申请结果：");
        console.log(res);
        //业务处理逻辑：
      })
      .catch(err => {
        console.log(err);
        resData.msg = "查询结清证明申请CMIS10000X接口调用异常: " + err;
        reject(resData);
      });
  });
};

/**
 * 结清证明申请开具(CMIS210082)
 *
 */
export const issueCMIS210082 = params => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    //拼接参数（CMIS100098，用于查询客户的申请列表信息）：
    var reqData_CMIS210082 = {};
    var targetbody_CMIS210082 = {};
    var request_CMIS210082 = {};
    var head_CMIS210082 = {}; //head信息
    var body_CMIS210082 = {}; //body信息
    head_CMIS210082.serviceId = "CMIS";
    request_CMIS210082.head = head_CMIS210082;

    body_CMIS210082.loanNo = params.loanNo; //借据号
    body_CMIS210082.cust_name = params.cust_name; //客户姓名
    body_CMIS210082.apply_dt = params.apply_dt; //申请日期
    body_CMIS210082.receiptFrom = params.receiptFrom; //收件形式
    body_CMIS210082.receiptTel = params.receiptTel; //收件人联系电话
    body_CMIS210082.receiptAddr = params.receiptAddr; //收件人地址
    body_CMIS210082.receiptEmail = params.receiptEmail; //收件人邮箱
    body_CMIS210082.applyUsr = params.applyUsr; //申请人
    body_CMIS210082.message = params.message; //备注

    request_CMIS210082.body = body_CMIS210082;

    targetbody_CMIS210082.request = request_CMIS210082;
    reqData_CMIS210082.targetbody = targetbody_CMIS210082;
    reqData_CMIS210082.targetSysCode = "esb";
    reqData_CMIS210082.actionCode = "query";
    reqData_CMIS210082.targetRoute = "directEsbQuery";
    console.log("调用CMIS 请求参数：");
    console.log(reqData_CMIS210082);

    //调用 CMIS 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS210082
    )
      .then(res => {
        console.log("调用结清证明申请开具接口结果：");
        console.log(res);
        //业务处理逻辑：
        //res.data.ec='0000'
        resData = res;
        resolve(resData);
      })
      .catch(err => {
        console.log(err);
        resData.retCode = "0";
        resData.msg = "查询结清证明申请CMIS接口调用异常: " + err;
        reject(resData);
      });
  });
};

/**
 * 溢缴款认领接口(CMIS200063)
 *
 */
export const claimCMIS200063 = params => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    //拼接参数（CMIS200063）：
    var reqData_CMIS200063 = {};
    var targetbody_CMIS200063 = {};
    var request_CMIS200063 = {};
    var head_CMIS200063 = {}; //head信息
    var body_CMIS200063 = {}; //body信息
    head_CMIS200063.serviceId = "CMIS200063";
    request_CMIS200063.head = head_CMIS200063;

    body_CMIS200063.remitName = ""; //汇款人名称
    body_CMIS200063.remitAcc = ""; //汇款人账号
    body_CMIS200063.gatAcc = ""; //收款账号
    body_CMIS200063.idNo = ""; //认领人证件号码
    body_CMIS200063.claAmt = ""; //认领金额
    body_CMIS200063.remitDt = ""; //汇款日期
    body_CMIS200063.remitKey = ""; //渠道认领主键
    request_CMIS200063.body = body_CMIS200063;

    targetbody_CMIS200063.request = request_CMIS200063;
    reqData_CMIS200063.targetbody = targetbody_CMIS200063;
    reqData_CMIS200063.targetSysCode = "esb";
    reqData_CMIS200063.actionCode = "query";
    reqData_CMIS200063.targetRoute = "directEsbQuery";
    console.log("调用CMIS00063 请求参数：");
    console.log(reqData_CMIS200063);

    //调用 CMIS200063 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS200063
    )
      .then(res => {
        console.log("调用溢缴款认领接口结果：");
        console.log(res);
        //业务处理逻辑：
        //res.data = {}
        //res.data.ec='0000'
        resData = res;
        resolve(resData);
      })
      .catch(err => {
        console.log(err);
        resData.retCode = "0";
        resData.msg = "溢缴款认领CMIS200063 接口调用异常: " + err;
        reject(resData);
      });
  });
};

var testdemo = {
  targetSysCode: "idp",
  actionCode: "esb"
};
/**
 * 实时扣款接口(CMIS410013)
 *
 */
export const deductionCMIS410013 = params => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    //拼接参数（CMIS200063）：
    var reqData_CMIS410013 = {};
    var targetbody_CMIS410013 = {};
    var request_CMIS410013 = {};
    var head_CMIS410013 = {}; //head信息
    var body_CMIS410013 = {}; //body信息
    head_CMIS410013.serviceId = "CMIS410013";
    request_CMIS410013.head = head_CMIS410013;

    body_CMIS410013.loanNo = ""; //贷款借据号
    body_CMIS410013.cutPaymentType = ""; //扣款类型
    body_CMIS410013.cutPaymentAmt = ""; //扣款金额
    body_CMIS410013.applyDt = ""; //申请日期
    body_CMIS410013.sumLegalFee = ""; //诉讼费总额
    body_CMIS410013.crtUsr = ""; //发起人

    request_CMIS410013.body = body_CMIS410013;

    targetbody_CMIS410013.request = request_CMIS410013;
    reqData_CMIS410013.targetbody = targetbody_CMIS410013;
    reqData_CMIS410013.targetSysCode = "esb";
    reqData_CMIS410013.actionCode = "query";
    reqData_CMIS410013.targetRoute = "directEsbQuery";
    console.log("调用CMIS410013 请求参数：");
    console.log(reqData_CMIS410013);

    //调用 CMIS410013 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS410013
    )
      .then(res => {
        console.log("调用实时扣款接口结果：");
        console.log(res);
        //业务处理逻辑：
        //res.data = {}
        //res.data.ec='0000'
        resData = res;
        resolve(resData);
      })
      .catch(err => {
        console.log(err);
        resData.retCode = "0";
        resData.msg = "溢缴款认领CMIS200063 接口调用异常: " + err;
        reject(resData);
      });
  });
};

/**
 * 主动还款接口(CMIS200007)
 *
 */
export const rePayCMIS200007 = params => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    //拼接参数（CMIS200063）：
    var reqData_CMIS200007 = {};
    var targetbody_CMIS200007 = {};
    var request_CMIS200007 = {};
    var head_CMIS200007 = {}; //head信息
    var body_CMIS200007 = {}; //body信息
    var updateLmPmShdList = {}; //updateLmPmShdList信息
    var updateLmPmShd = {}; //updateLmPmShd
    head_CMIS200007.serviceId = "CMIS200007";
    request_CMIS200007.head = head_CMIS200007;

    body_CMIS200007.billNo = ""; //第三方还款流水号  (非必填)
    body_CMIS200007.setlSeq = params.setlSeq; //还款流水号
    body_CMIS200007.loanNo = params.loanNo; //贷款借据号
    body_CMIS200007.contNo = params.contNo; //贷款合同编号
    body_CMIS200007.custName = params.custName; //客户名称
    body_CMIS200007.idType = params.idType; //证件类型
    body_CMIS200007.idNo = params.idNo; //证件号码
    body_CMIS200007.setlMode = params.setlMode; //还款模式
    body_CMIS200007.paymPerdCnt = params.paymPerdCnt; //缩期期数
    body_CMIS200007.setlRemPrcpPaym = params.setlRemPrcpPaym; //提前还本金额
    body_CMIS200007.setlTotalFee = params.setlTotalFee; //本次总计还款金额
    body_CMIS200007.setlOrigin = params.setlOrigin; //主动还款渠道
    body_CMIS200007.setlmtDt = params.setlmtDt; //主动还款日期
    body_CMIS200007.setlApplyDt = params.setlApplyDt; //主动还款申请日期
    body_CMIS200007.setlCreateUsr = params.setlCreateUsr; //创建用户
    body_CMIS200007.crtOrg = params.crtOrg; //创建机构
    body_CMIS200007.lmPmShdInd = params.lmPmShdInd; //是否同步还款计划
    body_CMIS200007.lmPmShdVer = params.lmPmShdVer; //还款计划版本号

    updateLmPmShd.perdNo = params.perdNo; //期号
    updateLmPmShd.dueDt = params.dueDt; //到期日
    updateLmPmShd.psInstmAmt = params.psInstmAmt; //期工金额
    updateLmPmShd.psPrcpAmt = params.psPrcpAmt; //本金
    updateLmPmShd.psNormIntAmt = params.psNormIntAmt; //正常利息
    updateLmPmShd.psFeeAmt = params.psFeeAmt; //费用金额
    updateLmPmShd.psRemPrcp = params.psRemPrcp; //剩余本金
    updateLmPmShd.psOdInd = params.psOdInd; //逾期标识
    updateLmPmShd.settleSts = params.settleSts; //结清标识
    updateLmPmShd.rtFeeAmt = params.rtFeeAmt; //返费金额（达飞必输）
    updateLmPmShdList.updateLmPmShd = updateLmPmShd;
    body_CMIS200007.updateLmPmShdList = updateLmPmShdList;

    request_CMIS200007.body = body_CMIS200007;

    targetbody_CMIS200007.request = request_CMIS200007;
    reqData_CMIS200007.targetbody = targetbody_CMIS200007;
    reqData_CMIS200007.targetSysCode = "esb";
    reqData_CMIS200007.actionCode = "query";
    reqData_CMIS200007.targetRoute = "directEsbQuery";
    console.log("调用CMIS200007 请求参数：");
    console.log(reqData_CMIS200007);

    //调用 CMIS200007 核心接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CMIS200007
    )
      .then(res => {
        console.log("调用主动还款接口结果：");
        console.log(res);
        //业务处理逻辑：
        //res.data = {}
        //res.data.ec='0000'
        resData = res;
        resolve(resData);
      })
      .catch(err => {
        console.log(err);
        resData.retCode = "0";
        resData.msg = "调用主动还款CMIS200007 接口调用异常: " + err;
        reject(resData);
      });
  });
};

/**
 * 还款计划导出
 *
 */
export const rePayPlanToExcel = params => {
  return new Promise((resolve, reject) => {
    var head = {}; //head信息
    var body = {}; //body信息
    var reqData = {};
    var targetbody = {};
    var request = {};

    request.head = head;
    //body

    request.body = body;
    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "query";
    reqData.targetRoute = "directEsbQuery";

    console.log("调用核心导出接口 请求参数：");
    // console.log(reqData);

    //调用核心导出功能接口
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/excelExport",
      reqData_CMIS200007
    )
      .then(res => {
        console.log("调用核心导出功能接口结果：");
        console.log(res);
        const url = window.URL.createObjectURL(new Blob([response.data]));
        const link = document.createElement("a");
        link.href = url;
        link.setAttribute("download", "repaymentPlan.xlsx"); //  或者通过response.headers['content-disposition']来获取文件名
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        window.URL.revokeObjectURL(url);
      })
      .catch(err => {
        console.log(err);
        resData.retCode = "0";
        resData.msg = "调用主动还款CMIS200007 接口调用异常: " + err;
        reject(resData);
      });
  });
};

/**
 *
 *系统用户信息同步(CC000001)
 */
export const queryInfoCC000001 = (turnPageBeginPos, turnPageShowNum) => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    var resListData = [];
    var msg = "";
    //拼接参数（CC000001，用于查询客户的申请列表信息）：
    var reqData_CC000001 = {};
    var targetbody_CC000001 = {};
    var request_CC000001 = {};
    var head_CC000001 = {}; //head信息
    var body_CC000001 = {}; //body信息

    head_CC000001.serviceId = "CC000001";

    request_CC000001.head = head_CC000001;

    body_CC000001.turnPageBeginPos = turnPageBeginPos;
    body_CC000001.turnPageShowNum = turnPageShowNum;

    request_CC000001.body = body_CC000001;

    targetbody_CC000001.request = request_CC000001;
    reqData_CC000001.targetbody = targetbody_CC000001;
    reqData_CC000001.targetSysCode = "esb";
    reqData_CC000001.actionCode = "query";
    reqData_CC000001.targetRoute = "directEsbQuery";

    console.log("调用CC000001 请求参数：");
    console.log(reqData_CC000001);

    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData_CC000001
    ).then(res => {
      console.log("系统同步面签信息", res);
      // resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号

      if (res.data.retCode == "200") {
        var array = res.data.cfUserList;

        array.forEach(item => {
          //每条证件号
          console.log(item.ctfNo);

          //调用 CC000002 客户号查询  通过证件号查询流水号，然后用流水号查贷款申请信息
          var reqData_CC000002 = {
            ctfType: "20",
            ctfNo: item.ctfNo
          };
          Axios.post(
            window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
            reqData_CC000002
          )
            .then(res2 => {
              if (res2.retCode === "200") {
                //赋值
                var data = res2.data;
                resListData.push(data);
              } else {
                msg +=
                  "申请流水号：" +
                  applSeq +
                  "调用CMIS100001发生异常:" +
                  res2.msg +
                  ";  ";
              }
            })
            .catch(err => {
              msg +=
                "申请流水号：" +
                applSeq +
                "调用CMIS100001发生异常:" +
                err +
                ";  ";
            });
        });
      }
    });
  });
};

console.log("testdemo==", testdemo);
/**
 *  JP
 *远程面签数据(CMIS200028)
 */
export const queryInfoCMIS200028 = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    // reqData_CMIS200028.targetSysCode = "esb";
    reqData.targetSysCode = testdemo.targetSysCode;
    // reqData_CMIS200028.actionCode = "query";
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";

    // reqData_CMIS200028.targetRoute = "directEsbQuery";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *领单，只能传单条数据
 */
export const queryInfodraw = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiObtain"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *调单，还要单独加接口获取行政组和人员
 */
export const queryInfotd = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiDispatch"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *面签客户信息
 */
export const queryInfofaceuserinfo = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *面签信息保存
 */
export const queryfaceuserinfosave = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiFillSummary"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *审核结论保存
 */
export const queryfaceuserinfoshjl = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiApprova"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.dispatchingPerson;
    reqData.agentId = agentInfo.dispatchingId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *挂起
 */
export const queryfaceuserinfogq = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiHang"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *核身问题模板查询列表
 */
export const queryfaceuserinfoQueryAll = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "VerifyQuestionBaseTemplate",
        tranCode: "vqntQueryDetails"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "verifyQuestionBaseTemplate";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *面签答题与视频保存
 */
export const queryfaceuserinfoQueryAllsave = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiFinish"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *查面签历史信息2
 */

/**
 *  JP
 *从内管拿座席信息
 */
export const getUserInfo = params => {
  return new Promise((resolve, reject) => {
    Axios.get(
      "/eurm/if/data/transfer/objList.ptc?dataType=" +
      params.dataType +
      "&deptGroupCode=" +
      params.deptGroupCode +
      "&isQueryRelObj=" +
      params.isQueryRelObj +
      "&pageNo=1&limit=100"
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};
//内管行政组信息2
export const getUserInfo2 = params => {
  return new Promise((resolve, reject) => {
    Axios.get(
      "/server/v1/sync/dept/childTree?dept=" +
      params.deptGroupCode +
      "&tenantId=" +
      params.tenantId
      // "/eurm/if/data/transfer/objList.ptc?dataType=" +
      // params.dataType +
      // "&deptGroupCode=" +
      // params.deptGroupCode +
      // "&isQueryRelObj=" +
      // params.isQueryRelObj +
      // "&pageNo=1&limit=100"
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/** 行政组拿座席信息
 * http://10.10.4.71:8000/server/v1/tenant/dept/agents?dept=credit&tenantId=default
 * @param {*} applSeq
 * @param {*} agentInfo
 * @returns
 */
export const getagentuser = params => {
  return new Promise((resolve, reject) => {
    Axios.get(
      "/server/v1/tenant/dept/agents?dept=" +
      params.deptGroupCode +
      "&tenantId=" +
      params.tenantId
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 * 申请人信息查询
 * CMIS100001
 */
export const queryfaceuserinfoCMIS100001 = (applSeq, agentInfo) => {
  return new Promise((resolve, reject) => {
    var phone = "";
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息

    head.serviceId = "CMIS100001";
    request.head = head;

    body.applSeq = applSeq; //流水号
    request.body = body;

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "custQueryLoanDetailsByIdentityCard";
    // console.log(reqData);
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
    });
  });
};

/**
 *  JP
 * 贷款记录查询 传idNo
 * CMIS100098
 */
export const queryfaceuserinfoCMIS100098 = (idNo, agentInfo) => {
  return new Promise((resolve, reject) => {
    var phone = "";
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息

    head.serviceId = "CMIS100098";
    request.head = head;

    body.idNo = idNo; //身份证号
    request.body = body;

    targetbody.request = request;
    targetbody.needStatus = true;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "custQueryLoanDetailsByIdentityCard";
    // console.log(reqData);
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
    });
  });
};

/**
 *  JP
 * 贷款记录查询 传idNo
 * CMIS100098
 */
export const queryfaceuserinfoCMIS100020 = (applSeq, agentInfo) => {
  return new Promise((resolve, reject) => {
    var phone = "";
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息

    head.serviceId = "CMIS100020";
    request.head = head;

    body.applSeq = applSeq; //身份证号
    request.body = body;

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "directEsbQuery";
    // console.log(reqData);
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
    });
  });
};

/**
 *  JP
 * 电审风险
 * CMIS100031   传applSeq
 */
export const queryfaceuserinfoCMIS100031 = (applSeq, agentInfo) => {
  return new Promise((resolve, reject) => {
    var phone = "";
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息
    // applCde
    head.serviceId = "CMIS100031";
    request.head = head;

    body.applSeq = applSeq; //申请编号
    request.body = body;

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "directEsbQuery";
    // console.log(reqData);
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
    });
  });
};

/**
 *  JP
 * 征信查询
 * CMIS100023   idTyp idNo custName
 */
export const queryfaceuserinfoCMIS100023 = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var phone = "";
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息

    head.serviceId = "CMIS100023";
    request.head = head;

    body = params;
    request.body = body;

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "directEsbQuery";
    // console.log(reqData);
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
    });
  });
};

/**
 *  JP
 *新增问题模板
 */
export const addnewanswertab = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "VerifyQuestionBaseTemplate",
        tranCode: "vqntAdd"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "verifyQuestionBaseTemplate";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *编辑问题模板
 */
export const setnewanswertab = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "VerifyQuestionBaseTemplate",
        tranCode: "vqntModify"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "verifyQuestionBaseTemplate";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *查询问题模板列表
 */
export const getnewanswertab = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "VerifyQuestionBaseTemplate",
        tranCode: "vqntQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "verifyQuestionBaseTemplate";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *查询问题模板详情
 */
export const getnewanswerinfo = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "VerifyQuestionBaseTemplate",
        tranCode: "vqntQueryDetails"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "verifyQuestionBaseTemplate";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *删除问题模板列表
 */
export const deletenewanswertab = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "VerifyQuestionBaseTemplate",
        tranCode: "vqntModify"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "verifyQuestionBaseTemplate";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *获取客户视频userid
 */
export const getuserid = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};

    reqData.targetbody = params;

    reqData.targetSysCode = "channel";
    reqData.actionCode = "query";

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "getSeqNoByIdNo";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      // window.CONFIG.idpServerUrl + "/api/user/getSeqNoByIdNo",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *获取历史答题
 */
export const gethistoryvideo = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterviewAnswerHistory",
        tranCode: "fiahQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;

    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInteAnswHist";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *获取客户就绪状态和时间
 */
export const getfaceTime = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};

    reqData.targetbody = params;

    reqData.targetSysCode = "channel";
    reqData.actionCode = "query";

    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceTime";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *视频调阅多条
 */
export const queryInfofaceuserinfo2 = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiQueryDetails"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *面签内容历史列表
 */
export const getqueryInfohistorylist = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInteSummary",
        tranCode: "fisQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInteSummary";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *面签内容历史列表--打回和原始数据
 */
export const getqueryInfohistorylists = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "FaceInterview",
        tranCode: "fiQueryDetails"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "faceInterview";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 * 固定问题答案获取
 * CMIS100001
 */
export const queryget100001 = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var resData = {}; //返回数据
    resData.retCode = "0";
    resData.flag = "false";
    //调用idp接口，拼接参数：
    var reqData = {};
    var targetbody = {};
    var request = {};
    var head = {}; //head信息
    var body = {}; //body信息

    head.serviceId = "CMIS100001";
    request.head = head;

    body = params;
    request.body = body;

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = "esb";
    reqData.actionCode = "esb";
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "directEsbQuery";
    // console.log(reqData);
    Axios.post(
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
    });
  });
};


/**
 *  JP
 *录音调听
 */
export const queryRecording = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "LogCallInfo",
        tranCode: "lciQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "logCallInfo";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *工单信息
 */
export const queryWorkorder = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "WorkTask",
        tranCode: "wtQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "workTask";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};

/**
 *  JP
 *工单历史信息Hist
 */
export const queryWorkorderHistory = (params, agentInfo) => {
  return new Promise((resolve, reject) => {
    var reqData = {};
    var targetbody = {};

    var request = {
      head: {
        serviceId: "WorkTaskHistory",
        tranCode: "wthQueryAll"
      },
      body: params
    };

    targetbody.request = request;
    reqData.targetbody = targetbody;
    reqData.targetSysCode = testdemo.targetSysCode;
    reqData.actionCode = testdemo.actionCode;
    // //操作人
    reqData.operator = agentInfo.agentName;
    reqData.agentId = agentInfo.agentId;
    reqData.source = "workbench";
    reqData.targetRoute = "workTaskHistory";

    Axios.post(
      //测试环境要两个biz
      window.CONFIG.idpServerUrl + "/biz/camel/v1/com/query",
      reqData
    ).then(res => {
      resolve(res);
      //res为系统同步的客户证件号，根据证件号去查询流水号
    });
  });
};